In the last videos we created the price weighted equal weighted and very weighted indexes based on price
returns only because we used the closing prices of our stocks that do not include dividends which are
actually an important part of total performance or total return.
And in this video we will create the price weighted Total Return Index are and in other words the price
weighted Performance Index and it's actually more complicated than one might think in a Total Return
Index.
The returns of our index constituents should be based on the adjusted close price data but the weighting
of constituents must be based on the close prices and therefore it would be wrong to simply add the
adjusted prices as we did before.
With the price way that price return index so coding wise the procedure follows the same intuition as
calculating the value weighted index.
First of all we use the returns of constituents based on adjusted close prices and then we need to wait.
This returns with a weight data frame that we derive from closing prices.
So this is the the most general way to create an index that always works.
But before we have seen with the price way that price return index and the equal weighted price return
index that there are some shortcuts but not in this case here and.
First of all we import pandas again and we import our index stocks CSP file.
So here we can see the adjusted close prices and the close prices so let's first of all select only
the adjusted close prices and uh we save this in a new data frame adjusted close and then we can decorate.
The daily total returns by using the percentage change method.
So this is nothing new.
So these are the daily returns of our stocks and also we need to select uh the close prices to get the
weightings and we save the close data frame and the variable close and then we can calculate the weights
for our six stocks on each and every timestamp.
And we can do this here with a combination of the diff method and the sum method.
This is actually nothing new.
We did this when we created the value weighted index.
And let's have a look here.
And then we did this with that evaluated index.
Instead of using the close price data frame we use the data frame with the market capitalizations.
So the intention here is nevertheless the same.
And these are our weights.
So no surprise that the Amazon stock has the highest weights as the closing prices are by far the highest
and we've said in part that the normalized data frame with the normalized stock prices for our six stocks
and with the the indexes or the value weighted index the price weighted index and the equal weighted
index.
And these are all price return index.
And we create a new column price weighted index the performance and first of all we assign assigned
to each and every timestamp the value of one hundred and several here.
So here on the very right hand side we create our new price weighted Performance Index and having now
the total return data frame with the daily total returns and the weights data frame then we can actually
calculate the cumulative investment multiples.
So this is nothing new.
And we derive to this code and did this before when we created the evaluated index.
So let's simply run the sell here and we actually overwrite all values and the price weighted performance
index starting from the second element here.
And let's again have a look at our norm data frame.
So here we have our price weighted performance index.
And now we can also create these summary data frame.
So also this is nothing new.
And we actually annualize risk and return are mean and standard deviation so here we have now the annualized
mean and the annualized standard deviation of returns.
And here we can see the price where that price return index.
And here we have an annualized return of 20 percent and an annualized risk of 21 percent and comparing
this to the price weighted performance index.
We have a annualized return of 22 percent.
So we have 2 percent more return and this is simply the dividend payments and the risk is actually here
the same.
So we have here 21 percent.
And finally we can also compare price return and the total return by creating here a line plot.
So we are plotting here actually the price weighted index price return and the price weighted index
performance return and here we have in blue the price return.
And in RI in the performance return and both start actually at the beginning of 214 at the base value
of 100.
But then as the time goes on the constituents pay dividends and we actually reinvest our dividends into
our index and therefore the difference between the performance index and the price return Index increases
here.
And it's no surprise that the green graph is above the blue graph.
And as I said before this difference is simply that dividends.
So that's the difference between price return and total return.
And it always depends on the specific case whether we want to work with price returns or total returns
and for the time being we are now finished and I hope to see you also in the next video by.